package cn.antia.db;

import java.util.Map;

/**
 * User: Jair Shaw
 * Date: 2008-6-27
 * Time: 17:05:59
 */
public interface SQLGene {

    public String composeSql(String sql, String orderField, boolean isAsc, int start, int end);
    
    public SqlParams composeSql(SqlParams sqlParams, String orderField, boolean isAsc, int start, int end);

    /**
     * 组合SQL语句
     * @param sql o sql
     * @param orderField order field
     * @param isAsc order  ASC?
     * @param page page
     * @param pageSize  pagesize
     * @return sql
     */
    public String composeSqlPage(String sql, String orderField, boolean isAsc, int page, int pageSize);
    
    public SqlParams composeSqlPage(SqlParams sqlParams, String orderField, boolean isAsc, int page, int pageSize);

    /**
     * 将SQL转换为查询返回记录数量的SQL
     * @param sql sql
     * @return sql
     */
    public String getRecordCountSQL(String sql);

    /**
     * where语句
     * @param conditions condition
     * @param isExact exact query ?
     * @return sql
     */
    public SqlParams whereStatement(Map<String,Object> conditions,boolean isExact);
}
